<template>
  <div>
    <Form :model="formItem" :label-width="120" inline>
      <Tabs value="name0">
        <TabPane :label="$t('baseInfo')" name="name0">
          <FormItem :label="$t('equipment.deviceName')">
            <Select v-model="form.deviceName">
              <Option value="beijing">New York</Option>
              <Option value="shanghai">London</Option>
              <Option value="shenzhen">Sydney</Option>
            </Select>
          </FormItem>
          <FormItem :label="$t('equipment.outStorageTime')">
            <DatePicker
              type="date"
              :placeholder="$t('onSelect')"
              v-model="form.date"
            ></DatePicker>
          </FormItem>
          <FormItem :label="$t('equipment.serialNumber') + 'ID'">
            <Input v-model="form.input" :placeholder="$t('onEnter')"></Input>
          </FormItem>
        </TabPane>
      </Tabs>
      <Tabs value="name1">
        <TabPane :label="$t('agentInfo')" name="name1">
          <FormItem :label="$t('agency')">
            <Select v-model="form.agency">
              <Option :value="1">代理商</Option>
            </Select>
          </FormItem>
          <FormItem :label="$t('phone')">
            <Input
              v-model="form.phone"
              :placeholder="$t('onEnter')"
              readonly
            ></Input>
          </FormItem>
        </TabPane>
      </Tabs>
      <div
        style="
          display: flex;
          justify-content: space-around;
          width: 200px;
          margin: 20px auto;
        "
      >
        <Button type="primary" @click="onsubmit">{{ $t("onSubmit") }}</Button>
        <Button type="default" @click="goback(false)">{{
          $t("onCancle")
        }}</Button>
      </div>
    </Form>
  </div>
</template>

<script>
import { addMedEquipment, editMedEquipment } from "@/api/index";
export default {
  props: ["item"],
  data() {
    return {
      form: {},
    };
  },
  mounted() {
    this.form = this.item;
  },
  methods: {
    goback(status) {
      this.$emit("handlerdevice", status);
    },
    onsubmit() {
      if (this.form.id) {
        //表示更新
        this.goback(true);
      } else {
        //便是新增
        this.goback(true);
      }
    },
  },
};
</script>

<style>
</style>